package com.wzt.car.service.impl;

import com.wzt.base.service.impl.BaseServiceImpl;
import com.wzt.car.domain.CarResources;
import com.wzt.car.mapper.CarResourcesMapper;
import com.wzt.car.service.ICarResourcesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wzt
 * @since 2022-09-09
 */
@Service
public class CarResourcesServiceImpl extends BaseServiceImpl<CarResources> implements ICarResourcesService {
    @Autowired
    private CarResourcesMapper carResourcesMapper;

    @Override
    public void addOrUpdate(CarResources carResources) {
        Long carId = carResources.getCarId();

        //这里无论是否有都需要执行删除操作
        carResourcesMapper.removeByCardId(carId);
        carResourcesMapper.insert(carResources);
    }
}
